/*
*  Copyright 2019-2025 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.server;


import java.util.List;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.dao.InventoryTaskDao;
import me.zhengjie.dao.MaterialDao;
import me.zhengjie.dao.dto.InventoryTaskQueryCriteria;
import me.zhengjie.utils.PageResult;
import me.zhengjie.vo.Inventory.*;
import me.zhengjie.vo.Result;

/**
* @description 服务接口
* @author laoxu
* @date 2025-06-26
**/
public interface InventoryTaskService extends IService<InventoryTaskDao> {

    /**
    * 查询数据分页
    * @param criteria 条件
    * @param page 分页参数
    * @return PageResult
    */
    PageResult<InventoryTaskDao> queryAll(InventoryTaskQueryCriteria criteria, Page<Object> page);

    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<InventoryTaskDto>
    */
    List<InventoryTaskDao> queryAll(InventoryTaskQueryCriteria criteria);

    /**
    * 创建
    * @param resources /
    */
    void create(InventoryTaskDao resources);

    /**
    * 编辑
    * @param resources /
    */
    void update(InventoryTaskDao resources);

    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(List<String> ids);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<InventoryTaskDao> all, HttpServletResponse response) throws IOException;

    /**
     * 查询库存任务数据
     * @param criteria 库存任务查询条件
     * @return 库存任务数据
     */
    Page<InventoryTaskDao> findInventoryTaskData(InventoryTaskQueryCriteria criteria);

    Page<ContainerExtractVo> findAvailableExtractData(InventoryExtractBaseVo inventoryExtractBaseVo);

    Page<ContainerMoveVo> findAvailableMoveData(InventoryMoveBaseVo inventoryMoveBaseVo);


    /**
     * 创建库存任务
     * @param createInventoryVo 创建库存任务参数
     * @return 创建结果
     */
    Result<?> createInventorySheet(CreateInventoryVo createInventoryVo);

    /**
     * 启动盘点任务
     * @param taskId 任务单号
     * @return 启动结果
     */
    Result<?> startInventoryTask(String startName,String taskId);

    /**
     * 盘点单出库
     * @return 移动结果
     */
    Result<?> outBoundInventoryTask();


    /**
     * 盘点单扫描
     * @param containerCode 载具编码
     * @return 扫描结果
     */
    Result<?> inventoryScanContainer(String containerCode);


    /**
     * 盘点单扫描
     * @param itemBarCode 物料条码
     * @return 扫描结果
     */
    Result<?> inventoryScanMaterial(String containerCode, String itemBarCode);

    /**
     *
     * @param containerCode 载具编码
     * @param itemBarCode 物料条码
     * @return 绑定结果
     */
    Result<?> bingMaterialToContainerCode(String containerCode, String itemBarCode);

    /**
     *
     * @param itemBarCode 物料条码
     * @param quantity 数量
     * @return 更新结果
     */
    Result<?> inventoryUpdateQuantity(String itemBarCode, Double quantity);

    /**
     * 查询库存任务详情
     * @return
     */
    PageResult<InventoryDetailsVo> findInventoryTaskDetails(String taskId, Integer page, Integer size, String materialCode, String containerCode, Integer taskStatus);

    void updateContainerStatusByCode(String containerCode, Integer status);

    InventoryTaskDao findInventoryTaskByContainerCode(String containerCode);

    List<InventoryTaskDao> findInventoryTaskByTaskId(String taskId);


    Result<?> reportMissing(String itemBarCode);

    Result<?> inventoryCompleteMaterial(String containerCode);

    Result<?> findExistTask();
}